﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FlyWeightPattern
{
    public class ShapeFactory
    {
        private static Dictionary<string, Shape> circleMap = new Dictionary<string, Shape>();

        public static Shape GetCircle(string color)
        {
            if (circleMap.ContainsKey(color))
            {
                return circleMap[color];
            }

            Shape shape = new Circle(color);
            circleMap.Add(color, shape);

            Console.WriteLine("Creating circle of color : " + color);

            return shape;
        }
    }
}
